package com.lzp.springboot.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;

import java.util.Locale;

/**
 * @description: 自定义一个视图解析器，测试启动时会被ContentNegotiatingViewResolver自动加载。
 * @author: lzp
 * @createTime: 2021-09-29 07:24
 **/
@Configuration
public class CustomViewResolver {
    @Bean
    public ViewResolver myViewResolver (){
        return new MyViewResolver();
    }

    // 不做具体实现
    public static class MyViewResolver implements ViewResolver {
        @Override
        public View resolveViewName(String viewName, Locale locale) throws Exception {
            return null;
        }
    }
}
